<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script type="text/javascript">
    function page(n, s) {
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
    var flag = "";
    $(function () {

        //打印
        $("#print").on('click', function () {
            window.print();
        })
        //修改
        $("#update").on('click', function () {
            flag = 2;
            loadRight(2);
        })
        //充值
        $("#rechange").on('click', function () {
            flag = 3;
            loadRight(3);
        })


        //补办
        $("#reAdd").on('click', function () {
            flag = 4;
            loadRight(4);
        })
        //退卡
        $("#return").on('click',function () {
            flag = 5;
            loadRight(5);
        })


        //弹出右
        $("#add").on('click', function () {
            loadRight(1);
        })

        /**
         * 加载右侧数据
         * @param parentId
         * @returns {*}
         */
        function loadRight(flag) {
            hideShowTableTd('contentTable', '5,6,7,8,9,10', '2');
            $("#LeftDiv").attr("class", "main-content col-lg-8");
            $("#RightDiv").show('normal');
            return loadDiv('rigthCenterDiv', timestamp('${ctx}/med/medicalCardMaster/form?flag=' + flag));
        }

        //全选事件
        $("#all").on('click', function () {
            var isChecked = $(this).prop("checked");
            $("input[name='ordersId']").prop("checked", isChecked);
        })
    })
    //挂失
    function lost(id,cardStatus){
        if(cardStatus!="0"){
            toastr.error("此卡不可以挂失");
            return false;
        }else{
            delLoad('mainCenterDiv', '${ctx}/med/medicalCardMaster/update?id=' + id+'&cardStatus=1','${ctx}/med/medicalCardMaster/index');
        }
    }
    //

    //启用
    function reUse(id,cardStatus){
        if(cardStatus!="1"){
            toastr.error("此卡不可以启用");
            return false;
        }else{
            delLoad('mainCenterDiv', '${ctx}/med/medicalCardMaster/update?id=' + id+'&cardStatus=0','${ctx}/med/medicalCardMaster/index');
        }
    }

</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-12" id="LeftDiv">
            <div class="content-wrap">
                <div class="wrapper" style="bottom: 50px;">
                    <%--<ul class="nav nav-tabs">--%>
                    <%--<li>--%>
                    <%--<a href="#">一卡通列表</a>--%>
                    <%--</li>--%>
                    <%--</ul>--%>
                    <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="form-group">
                                <input class="btn btn-primary" type="button" value="办卡"
                                       style="background-color:#15db81;" id="add"/>
                                <input class="btn btn-primary" type="button" value="修改" id="update"
                                       style="background-color:#698B69;"/>
                                <input class="btn btn-primary" type="button" value="充值" id="rechange"
                                       style="background-color:#8B668B;"/>
                                <%--<input class="btn btn-primary" type="button" value="挂失" id="lost"--%>
                                       <%--style="background-color:#FFA54F;"/>--%>
                                <input class="btn btn-primary" type="button" value="补办" id="reAdd"
                                       style="background-color:#FFA54F;"/>
                                <input class="btn btn-primary" type="button" value="退卡" id="return"
                                       style="background-color:red;"/>
                                <%--<input class="btn btn-primary" type="button" value="启用" id="start"--%>
                                       <%--style="background-color:#90EE90;"/>&lt;%&ndash;//#90EE90&ndash;%&gt;--%>
                                <%--<input class="btn btn-primary" type="button" value="打印票据" id="print"--%>
                                       <%--style="background-color:#ccc;"/>--%>
                            </div>
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <form:form id="medicalCardMasterForm" modelAttribute="medicalCardMaster"
                                                   onsubmit="return loadDivForm('mainCenterDiv','medicalCardMasterForm','${ctx}/med/medicalCardMaster/index');"
                                                   method="post" class="form-inline">
                                            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                            <input id="pageSize" name="pageSize" type="hidden"
                                                   value="${page.pageSize}"/>

                                            <%--<label>建卡时间：</label>--%>
                                            <%--<input name="startTime" value="${medicalCardMaster.startTime}"--%>
                                                   <%--class="form-control Wdate" type="text"--%>
                                                   <%--onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"--%>
                                                   <%--readonly="readonly"/>--%>
                                            <%--<label>至</label>--%>
                                            <%--<input name="endTime" value="${medicalCardMaster.endTime}"--%>
                                                   <%--class="form-control Wdate" type="text"--%>
                                                   <%--readonly="readonly"--%>
                                                   <%--onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>--%>

                                            <label>姓名 ：</label><form:input path="nameQuery" htmlEscape="false" maxlength="50" class="form-control" /> &nbsp;

                                            <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                                        </form:form>
                                    </div>
                                </div>

                                <table id="contentTable" class="table table-bordered mg-t datatable">
                                    <thead>
                                    <tr>
                                        <%--<th>id</th>--%>
                                        <th>姓名</th>
                                        <th>卡号</th>
                                        <th>费别</th>
                                        <th>状态<%--0-可用 1-挂起 2-注销';--%></th>
                                        <th>余额</th>
                                        <th>省份证号码</th>
                                        <th>性别</th>
                                        <%--<th>手机号</th>--%>
                                        <th>年龄</th>
                                        <%--<th>expand1</th>--%>
                                        <%--<th>expand2</th>--%>
                                        <%--<th>expand3</th>--%>
                                        <%--<th>标志</th>--%>
                                        <th>创建人</th>
                                        <th>创建时间</th>
                                        <%--<th>更新人</th>--%>
                                        <%--<th>更新时间</th>--%>
                                        <%--<th>备注信息</th>--%>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${page.list}" var="medicalCardMaster">
                                    <tr>
                                        <td> ${medicalCardMaster.name}</td>
                                            <%--<td> ${medicalCardMaster.patientId}</td>--%>
                                        <td> ${medicalCardMaster.cardNo}</td>
                                        <td> ${fns:getDictLabel(medicalCardMaster.expand1, 'CHARGE_TYPE_DICT', '')}</td>
                                        <td> ${fns:getDictLabel(medicalCardMaster.cardStatus, 'card_status', '')}</td>
                                        <%--<td> ${medicalCardMaster.rcptNo}</td>--%>
                                        <%--<td> ${medicalCardMaster.rechangeFlag==0?"充值":"未充值"}</td>--%>
                                        <%--<td> ${medicalCardMaster.deposit}</td>--%>
                                        <td> ${medicalCardMaster.balance}</td>
                                        <td> ${medicalCardMaster.idCard}</td>
                                        <%--<td>${fns:getDictLabel(medicalCardMaster.rechangeType, 'card_pay_way', '')}</td>--%>
                                            <%--<td> ${medicalCardMaster.orgId}</td>--%>
                                            <%--<td> ${medicalCardMaster.name}</td>--%>
                                        <td> ${medicalCardMaster.sex==2?"男":"女"}</td>
                                        <%--<td> ${medicalCardMaster.phone}</td>--%>
                                            <%--<td> ${medicalCardMaster.backCard}</td>--%>
                                            <%--<td> ${medicalCardMaster.carteVital}</td>--%>
                                        <td> ${medicalCardMaster.age}</td>
                                            <%--<td> ${medicalCardMaster.expand1}</td>--%>
                                            <%--<td> ${medicalCardMaster.expand2}</td>--%>
                                            <%--<td> ${medicalCardMaster.expand3}</td>--%>
                                            <%--<td> ${medicalCardMaster.delFlag}</td>--%>
                                        <td> ${fns:getUserName(medicalCardMaster.createBy.id)}</td>
                                        <td><fmt:formatDate value="${medicalCardMaster.createDate}"
                                                            pattern="MM-dd HH:mm"/></td>

                                            <%--<td> ${medicalCardMaster.updateBy.id}</td>--%>
                                            <%--<td> ${medicalCardMaster.updateDate}</td>--%>
                                            <%--<td> ${medicalCardMaster.remarks}</td>--%>
                                        <td>
                                            <a href="#"
                                               onclick="lost('${medicalCardMaster.id}','${medicalCardMaster.cardStatus}')"
                                               class="applyBt btn btn-danger btn-xs">挂失</a>
                                            <a href="#"
                                               onclick="reUse('${medicalCardMaster.id}',${medicalCardMaster.cardStatus})"
                                               class="btn btn-success btn-xs">启用</a>
                                        </td>
                                    </tr>
                                    </c:forEach>

                                </table>
                                <div class="pagination">${page}</div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
        <section class="main-content col-lg-4" style="display: none" id="RightDiv">
            <div class="content-wrap" id="rigthCenterDiv">
            </div>
        </section>
    </section>

</div>

